From fa242b7ec614879cdd64d7e47b7543e248024863 Mon Sep 17 00:00:00 2001 From: Stefano Zacchiroli Date: Sat, 9 Jul 2005 16:49:49 +0000 Subject: [PATCH] remove md5sums dir when registry is empty on update --- ocaml-md5sums.ml.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ocaml-md5sums.ml.in b/ocaml-md5sums.ml.in index dc5dceec..806a50a3 100644 --- a/ocaml-md5sums.ml.in +++ b/ocaml-md5sums.ml.in @@ -4,7 +4,7 @@ * Copyright (C) 2005, Stefano Zacchiroli * * Created: Wed, 06 Apr 2005 16:55:39 +0200 zack - * Last-Modified: Sat, 09 Jul 2005 17:40:44 +0200 zack + * Last-Modified: Sat, 09 Jul 2005 18:43:03 +0200 zack * * This is free software, you can redistribute it and/or modify it under the * terms of the GNU General Public License version 2 as published by the Free @@ -249,9 +249,9 @@ let dep objects () = let update () = info (sprintf "updating registry %s using info from %s/" registry_file md5sums_dir); - let registry = open_out registry_file in let keys = Hashtbl.create 1024 in (* history of seen registry keys *) let dir = Unix.opendir md5sums_dir in + let registry = open_out registry_file in try while true do let fname = sprintf "%s/%s" md5sums_dir (Unix.readdir dir) in @@ -271,7 +271,10 @@ let update () = with End_of_file -> Unix.closedir dir; close_out registry; - if is_empty registry_file then Sys.remove registry_file + if is_empty registry_file then begin + Sys.remove registry_file; + ignore (Sys.command ("/bin/rmdir -p " ^ md5sums_dir)) + end (** {2 Main} *) -- 2.30.2